package com.kakarote.core.common.enums;

import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
import com.kakarote.core.common.ResultCode;

import java.util.List;

public enum ExamineSystemEnum implements ResultCode {

    OA(0,"办公审批"),
    CRM(1,"CRM审批"),
    HRM(5,"HRM"),
    JXC(6,"进销存");

    ExamineSystemEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static List<Integer> listLabel(Integer type) {
        if (ExamineSystemEnum.CRM.getCode() == type) {
            return ExamineLabelEnum.getCrmCode();
        } else if (ExamineSystemEnum.HRM.getCode() == type) {
            return ExamineLabelEnum.getHrmCode();
        } else if (ExamineSystemEnum.JXC.getCode() == type) {
            return ExamineLabelEnum.getJxcCode();
        } else if (ExamineSystemEnum.OA.getCode() == type) {
            return ExamineLabelEnum.getOaCode();
        }
        return Lists.newArrayList();
    }

    private int code;
    private String msg;

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    public static ExamineSystemEnum get(Integer code) {
        for (ExamineSystemEnum value : values()) {
            if (value.getCode() == code) {
                return value;
            }
        }
        return null;
    }
}
